function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,' ');
	}
}

function clearText(field){
	/* le contenu était à sa valeur par defaut et on obtient le focus */
    if (field.defaultValue == field.value){
		field.value = '';
		/*field.className = "fieldContent";*/
		removeClass ( field, "fieldDefaultContent" );
		addClass ( field, "fieldContent" );
	}
	/* le contenu était à vide et on prend le focus */
    else if (field.value == ''){
		field.value = field.defaultValue;
		/*field.className = "fieldDefaultContent";*/
		removeClass ( field, "fieldContent" );
		addClass ( field, "fieldDefaultContent" );
	}
}
/*
function clearTextArea(field){
	alert ( field.defaultValue );
	field.value='';
	field.onfocus=null;
	removeClass ( field, "fieldDefaultContent" );
	addClass ( field, "fieldContent" );
	return true;
}
*/

function noFade (el){
	removeClass ( field, "fade" );
}

function replaceMe ( me, you ){
	removeClass ( me, "showBlock" );
	addClass ( me, "hide" );
	removeClass ( you, "hide" );
	addClass ( you, "showBlock" );
}

function replaceMeAndFocus ( me, you ){
	replaceMe ( me, you );
	you.focus().select();
}

function replaceMeIfEmpty ( me, you ){
	if ( me.value == '' ){
		replaceMe ( me, you );
	}
	removeClass ( you, "ui-focus" );
}

function supports_input_placeholder() {
  var i = document.createElement('input');
  return 'placeholder' in i;
}

function click(element) {
	$.mobile.changePage(element.attr("href"));
}

function deco() {
	var link = $('deco');
    if(confirm('Voulez-vous vraiment vous déconnecter ?')) {
		link.attr("href", link.attr("href"));
	} else {
		link.attr("href", "");
	}
}
